﻿<UserControl x:Class="FileDuplicateUtility.FilterList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:l="clr-namespace:FileDuplicateUtility"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.DataContext>
        <Binding RelativeSource="{RelativeSource Mode=Self}"/>
    </UserControl.DataContext>
    <UserControl.Resources>
        <RoutedUICommand x:Key="MoveFilterCmd"/>
    </UserControl.Resources>
    <UserControl.CommandBindings>
        <CommandBinding Command="{StaticResource MoveFilterCmd}" Executed="MoveFilterCmd_Executed"/>
    </UserControl.CommandBindings>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <ListView Grid.Column="0" ItemsSource="{Binding Path=Filters, Mode=OneWay}" SelectedIndex="{Binding Path=SelectedIndex, Mode=TwoWay}" DisplayMemberPath="Display"/>
        <Grid Grid.Column="1" Margin="2,0,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Button Grid.Row="0" Width="20" Command="{StaticResource MoveFilterCmd}" CommandParameter="Up">
                <Path Data="M0,1 L1,1 0.5,0Z" Stretch="Uniform" Fill="Black"/>
            </Button>
            <Button Grid.Row="1" Width="20" Command="{StaticResource MoveFilterCmd}" CommandParameter="Add">
                <Path Data="M0,0 L0,1 -1,0.5Z" Stretch="Uniform" Fill="Black"/>
            </Button>
            <Button Grid.Row="2" Width="20" Command="{StaticResource MoveFilterCmd}" CommandParameter="Remove">
                <Path Data="M0,0 L0,1 1,0.5Z" Stretch="Uniform" Fill="Black"/>
            </Button>
            <Button Grid.Row="3" Width="20" Command="{StaticResource MoveFilterCmd}" CommandParameter="Down">
                <Path Data="M0,0 L1,0 0.5,1Z" Stretch="Uniform" Fill="Black"/>
            </Button>
        </Grid>
        
        <l:FilterSelector x:Name="Selector" Grid.Column="2" Margin="2,0,0,0"/>
    </Grid>
</UserControl>
